Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Android): improve RN detection in build scripts #2537

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Nov 22, 2024

Description

It has been reported that there are project configurations in which "$projectDir/../node_modules/react-native" exists, but node module resolution algorithm
fails to find it. I've reintroduced the aforementioned location.

Test code and steps to reproduce

Our examples should keep working as always ^^

Checklist

@kkafar kkafar requested a review from WoLewicki November 22, 2024 14:05
}

// We're in non standard setup - try to use node resolver to locate the react-native package.
String searchResult = ["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String searchResult = ["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()
String searchResult = ["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()
if (searchResult == null || searchResult.isBlank()) {
searchResult = ["node", "--print", "require.resolve('react-native/package.json')"].execute(null, projectDir).text.trim()
}

@kkafar kkafar merged commit 1142399 into main Nov 22, 2024
4 checks passed
@kkafar kkafar deleted the @kkafar/fix-build-on-android branch November 22, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants